<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      h1 {
        position: relative;
        width: 55px;
        height: 55px;
        background-color: #ff6700;
        margin: 100px auto;
        /* 将文字的大小设置0像素  */
        font-size: 0;
        overflow: hidden;
      }
      h1 a {
        display: block;
        width: 100%;
        height: 100%;
        
      }
      /* 并集选择器 */
      h1 a::after,
      h1 a::before {
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        content: '';
        transition: all 0.2s;
        background-position: center center;
      }
      h1 a::after {
        left: 0;
        background-image: url(./images/mi-logo.png);
      }
      h1 a::before {
        left: -55px;
        content: '';
        background-image: url(./images/mi-home.png);
      }
      h1 a:hover::after {
        left: 55px;
      }
      h1 a:hover::before {
        left: 0;
      }
    </style>
  </head>
  <body>
    <!-- 需要先准备一个放 logo的盒子 -->
    <h1>
      <a href="#" title="小米官网">小米官网</a>
    </h1>
  </body>
</html>
